// import { computed } from "vue";
// import { useRoute } from "vue-router";
import { useAuthStore } from "@/stores/modules/auth";

/**
 * @description 页面按钮权限
 * */
export const useAuthApis = () => {
  const authStore = useAuthStore();
  const index = authStore.flatMenuListGet.findIndex((e: any) => e.name === authStore.routeName);
  const nowRoute = authStore.flatMenuListGet[index];

  const authApi = (name: string): boolean => {
    const index = nowRoute.apis.findIndex(e => e.api_name === name);
    if (index === -1) return false;
    return true;
  };

  return {
    authApi
  };
};
